package com.smart_campus.sys.service.impl;

import com.smart_campus.sys.common.MD5Utils;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import com.smart_campus.sys.mapper.UserInfoMapper;
import com.smart_campus.sys.domain.UserInfo;
import com.smart_campus.sys.service.UserInfoService;
/**
*@Author:Omega
*@Date:2020/6/12 19:24
*/
@Service
public class UserInfoServiceImpl implements UserInfoService {

    @Resource
    private UserInfoMapper userInfoMapper;

    @Override
    public int deleteByPrimaryKey(Integer userinfoId) {
        return userInfoMapper.deleteByPrimaryKey(userinfoId);
    }

    @Override
    public int insert(UserInfo record) {
        return userInfoMapper.insert(record);
    }

    @Override
    public int insertSelective(UserInfo record) {
        return userInfoMapper.insertSelective(record);
    }

    @Override
    public UserInfo selectByPrimaryKey(Integer userinfoId) {
        return userInfoMapper.selectByPrimaryKey(userinfoId);
    }

    @Override
    public int updateByPrimaryKeySelective(UserInfo record) {
        return userInfoMapper.updateByPrimaryKeySelective(record);
    }

    @Override
    public int updateByPrimaryKey(UserInfo record) {
        return userInfoMapper.updateByPrimaryKey(record);
    }

    /**
     * 通过用户表的id查询用户详情的信息
     * @param userID
     * @return
     */
    @Override
    public UserInfo selectByUserID(Integer userID) {
        return userInfoMapper.selectByUserID(userID);
    }

    /**
     * 通过用户信息查询用户详情
     * @param userInfo
     * @return
     */
    @Override
    public UserInfo selectByUserInfo(UserInfo userInfo) {
//        userInfo.setIdentity(MD5Utils.md5(userInfo.getIdentity()));
//        String md5 = MD5Utils.md5(userInfo.getIdentity());
//        userInfo.setIdentity(md5);
//        userInfo.setIdentity(MD5Utils.md5(userInfo.getIdentity()));
//        System.out.println("身份证。。。。。。。》》》"+userInfo.getIdentity());
        return userInfoMapper.selectByUserInfo(userInfo);
    }

    @Override
    public Integer querMax() {
        return userInfoMapper.querMax();
    }

}
